<!--  edu_15_6_1.html -->
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html lang="en">
 <head>
  <meta charset="UTF-8">
		<title>用户注册页面</title>
		<style type="text/css">
			  strong{color:red;font-style:bolder;}
        fieldset{width:560px;height:186px;padding:0px 50px;}
        #button{margin:10px 20px;}
			div.we{margin-left: auto;
			margin-right: auto;
			width:400px}
			 </style>
		<script  type="text/javascript">

      function $(id){return document.getElementById(id);}
			function checkReg(){			
				var username=$("myname").value;
				var pwd=$("mypwd1").value;
				var pwdConfirm=$("mypwd2").value;
				var checkright=true;
                if(username==${data.username}){
                    alert("用户已存在，请直接登录")
                    //alert(data.msg)

                }
				if(username=="" || pwd=="")  //两者中有一个为空
				{
					alert("请确认用户名和密码输入是否正确！！");
					checkright=false;
				}
				else    //不为空，再判断用户名和密码的长度合法性
				{ 
					if(username.length<6)
					{
						alert("用户名长度太短，至少6个字符！！");
						checkright=false;
					}	else if(pwd.length<6)
					{
						alert("密码长度太短，至少6个字符！！");
						checkright=false;
					}	else if(pwd!=pwdConfirm)
					{
						alert("两次输入的密码必须一致！！");
						checkright=false;
					}	else
          {	checkright=true;}
				}

				return checkright;
			}
			function clearInfo()
			{
				var flag = confirm("确认要重置数据吗？");
				if(flag==true)
				{
					$("myname").value = "";
					$("mypwd1").value = "";
					$("mypwd2").value = "";
				}
			}
			function cli() {
				//alert("注册时间-》"+document.write(str));
				alert(str)
			}
		</script>
	 <script type="text/javascript">
		 var now = new Date();
		 var y = now.getFullYear();
		 var m = now.getMonth()+1;
		 var d = now.getDate();
		 var h = now.getHours();
		 var mi = now.getMinutes();
		 var s = now.getSeconds();
		 if(m<10){m="0"+m;}
		 if(d<10){d="0"+d;}
		 if(h<10){h="0"+h;}
		 if(mi<10){mi="0"+mi;}
		 s=(s<10)?("0"+s):s;  //if(s<10){s="0"+s;}
		 var str = "注册时间"+y+"年"+m+"月"+d+"日 "+h+":"+mi+":"+s;

	 </script>
	</head>
	<body>
	<div  class="we">
		<%--<div action="LagIn" method="get" onSubmit="return checkReg()" onReset="clearInfo()">--%>
	<form >
			<div action="LagIn" method="get" onSubmit="return checkReg()" onReset="clearInfo()">
				<legend align="center" >新用户注册</legend><br>
			</div>
				<table border="2" cellpadding="1">
					<label >用&nbsp;户&nbsp;名: </label>
          <input type="text" name="myname" id="myname"><strong>(用户名要大于6位)</strong><br>
					<label> 登录密码: </label>
          <input type="password" name="mypwd1" id="mypwd1"><strong>(密码要大于6位)</strong><br>
					<label> 密码确认: </label>          
          <input type="password" name="mypwd2" id="mypwd2"><br>
			<input id="button2" type="submit" value="用户注册" onclick="checkReg();" >

					<input type="button" value="登录" width="5" onclick="javascrtpt:window.location.href='LagIn'" />
					<input  id="button1" type="reset" value="重置">
				</table>
		</form>
	</div>
	</body>
</html>